<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Array_Sort</title>
        <style type="text/css">
            h3 {
                text-align: center;
            }
            div {
                text-align: center;
            }
        </style>
        <script>
            function cmp(a,b){
                return b-a;
            }
            function arr_sort(){
                let inp = document.getElementById("num").value;
                let arr_n = inp.split(',');
                arr_n.sort(cmp);
                let str = arr_n[0];
                for(let i = 1;i<arr_n.length;++i)
                    str += ','+arr_n[i];
                document.getElementById("out").innerHTML="排序结果："+str;
            }
        </script>
    </head>
    <body>
        <h3>输入一组整数，进行从大到小排序，数字以逗号分割</h3>
        <div>
            <input id="num" name="number" type="text" size="50">
            <button onclick="arr_sort()">排序</button>
        </div>
        <div>
            <textarea id="out" cols="70" rows="5" readonly></textarea>
        </div>
    </body>
</html>